﻿@model IEnumerable<VehicleManagement.Models.Message>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="../../Content/css/page_yk_index.css" rel="stylesheet" type="text/css" />


@Html.Partial("_PartviewApplyNav")


<div class="content bc">
    <div class="content_link_warn f12">
        你当前的位置：信息提醒&gt&gt &nbsp;&nbsp;个人信息系统
    </div>
    <div class="content_right fr" id="rightcontent">
        <div class="column">
            <h4 class="title f14">
                个人信息记录
            </h4>
        </div>
        <div class="maincontent">
            <div class="driveinfolist f14">
            <div class="driveinfolist f14">
                <div class="msghead">
                    <span class="msgdel magheadshare">删除</span>
                    <span class="msgsender magheadshare"> 发件人</span>
                    <span class="msgcontent magheadshare">消息内容</span>
                    <span class="msgtime magheadshare">时间</span>
                </div>
                @foreach (var item in Model)
                {
                    <div class="messagewrap">
                        <div class="t_wrap">
                            
                                <span class="delwrap">
                                    @*@Html.ActionLink(" ", "Delete", new { id = item.MessageID })*@
                                    <a href="javascript:void(0)" onclick="DeleteMessage(@item.MessageID)"></a>
                                </span>
                                <span class="imgwrap" onclick="readmsg1(this,@item.MessageID)">
                                    @if (item.IsChecked == false)
                                    {
                                        <img class="msgico" alt=".." src="../../Content/themes/picture/yk_pic/warn_pic.png" />
                                    }
                                    else
                                    {
                                        <img class="msgico" alt=".." src="../../Content/themes/picture/yk_pic/warn_pic_off.png" />
                                    }
                                </span>
                                <span class="namewrap">
                                    <a href="javascript:void(0)" class="sender">&nbsp;@Html.DisplayFor(modelItem => item.SenderName)</a>
                                </span>
                        </div>
                        <div class="m_text" onclick="readmsg2(this,@item.MessageID)">
                            &nbsp;&nbsp;&nbsp;&nbsp;@Html.DisplayFor(modelItem => item.MessageText)
                        </div>
                        <div class="b_time">
                            @Html.DisplayFor(modelItem => item.SendTime)                            
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
    </div>
    @Html.Partial("_PartviewMessgeleftbar")
    <div class="content_contract fl">
        <a href="javascript:void(0)" class="btn_contract w8h32" id="contract" title="收缩">
        </a><a href="javascript:void(0)" class="btn_expand w8h32" id="expand" title="展开">
        </a>
    </div>
    <div class="cb">
    </div>

</div>
<script type="text/javascript" src="../../Scripts/jquery-1.5.1.js"></script>
<script type="text/javascript">
    function DeleteMessage(id) {
        if (confirm("您确认删除这条消息吗?")) {
            if (id != '') {
                $.post("/Message/DeleteMessage", { "id": id },
                    function (data) {
                        if (data.Result == "true") {
                            alert(data.Message);
                            window.location.reload();
                        }
                        else {
                            alert(data.Message);
                        }
                    }
                );
            }
        }
    }

    $(document).ready(function () {
        $("#driver_cx_content").toggle();

        $(".delwrap a").append('<img class="delico" alt="删除" src="../../Content/themes/picture/yk_pic/close.png" title="删除该信息" />');

    });
    //点击信封图标
    function readmsg1(obj, id) {
        if ($(obj).parent().next(".m_text").width() == 300) {
            $(obj).parent().next(".m_text").css("width", "auto");
            $(obj).parent().next(".m_text").css("white-space", "normal");
        }
        else {
            $(obj).parent().next(".m_text").css("width", "300px");
            $(obj).parent().next(".m_text").css("white-space", "nowrap");
        }
        $(obj).children(".msgico").attr("src", "../../Content/themes/picture/yk_pic/warn_pic_off.png");

        $.post("/Message/ChangeMessageState", "id=" + id, function () { }, "json");
    }
    //点击消息内容
    function readmsg2(obj, id) {
        if ($(obj).width() == 300) {
            $(obj).css("width", "auto");
            $(obj).css("white-space", "normal");
        }
        else {
            $(obj).css("width", "300px");
            $(obj).css("white-space", "nowrap");
        }
        $(obj).prev().children().children(".msgico").attr("src", "../../Content/themes/picture/yk_pic/warn_pic_off.png");

        $.post("/Message/ChangeMessageState", "id=" + id, function () { }, "json");
    }
 
</script>

